package dyyx;

import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Date;

public class TelnetTest {
	
	public static void main(String[] args) throws Exception {
		
		System.out.println("TelnetTest,"+new Date());
		// echo conf|nc 10.57.239.118 2181
		
		String ip = "10.57.239.118";
		int port = 2181;
		
		Socket socket = new Socket(ip,port);
		        
		
		OutputStream outputStream=socket.getOutputStream(); 
		
		InputStream inputStream=socket.getInputStream(); 
		
		outputStream.write("conf\n".getBytes());
		
		byte[] bytes = Utils.toBytes(inputStream);
		System.out.println(new String(bytes));
		

		
		Utils.close(inputStream);
		
		Utils.close(outputStream);
		
		Utils.close(socket);



		
		
		
		
	}
}
